// dlg.txt

begintalkscript;

variables;

begintalknode 1;
	state = -1;
	nextstate = -1;
	condition = get_sdf(70,2) == 0;
	question = "special";
	text1 = "You have entered one of the wilder and more remote areas of the Dera Reaches. Which, considering how dangerous the northern areas are, says a lot.";
	text2 = "You are not far from the southern ocean, and the wet air is sustaining a large number of the twisted, fungal trees that live in this desert.";
	text3 = "A large road passes through the middle of these woods, running parallel to the shore. Long lines of huge, reptilian tracks run east to west and back again.";
	text4 = "Even if you hadn't seen the tracks, you can sense the residual energy left by these creatures in the passage. That and the long swaths of scorched earth tell you that the Unbound hunt here.";
	action = SET_SDF 70 2 1;

begintalknode 2;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You sense a powerful presence nearby. Something is approaching from the east. Something is hunting.";
	text2 = "One of the Unbound has returned to these woods.";

begintalknode 3;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "__";

begintalknode 4;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "__";

begintalknode 5;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "__";


begintalknode 10;
	state = -1;
	nextstate = 10;
	condition = 1;
	question = "Smith Fitz";
	text1 = "These cramped and miserably hot chambers have one occupant: a lone man in plate armor. It is amazing that he can withstand the heat without crumpling. He stands with his back to you, using a hammer to work essence into a broadsword.";
	text2 = "Then you see the insignia on his back. It is faded, but you can make it out. This man is, or was, a Guardian, before he came out here.";
	text3 = "Then he sets down his hammer, turns to you, and lifts the visor of his helmet. He is quite old, though still very strong. _I am Smith Fitz, and this is my shop._";
	text4 = "_I do work for those who Sage Taygen has allowed to be here._";
	text5 = "Smith Fitz, once a Guardian and now a blacksmith, continues to work as he speaks with you. He occasionally uses a minor spell to strengthen a weak component or work essence into some steel.";
	action = INTRO;

begintalknode 11;
	state = 10;
	nextstate = 11;
	condition = 1;
	question = "Were you a Guardian?";
	text1 = "He mutters, _I was._ It's clearly not a topic he is fond of discussing.";

begintalknode 12;
	state = 11;
	nextstate = -1;
	condition = 1;
	question = "Can you teach Shaping?";
	text1 = "_I am not allowed._ He picks up his hammer and passes it from hand to hand, eager to return to work.";

begintalknode 13;
	state = 11;
	nextstate = 12;
	condition = 1;
	question = "Why are you here now?";
	text1 = "_When Sage Taygen was sent to the Dera Reaches, I was sent with him. I served him for many years. Then, when the rebellion began to cross Terrestia, I had a disagreement with him._";

begintalknode 14;
	state = 12;
	nextstate = 10;
	condition = 1;
	question = "Over what?";
	text1 = "_His path toward ending the war. I do not discuss private Shaper business. I have always enjoyed working steel. I asked Taygen to be allowed to watch the forge and use my skills. He kindly allowed me to go. So I am here._";
	text2 = "_That is all I have to say about it._";

begintalknode 15;
	state = 10;
	nextstate = 13;
	condition = 1;
	question = "Tell me about this smithy.";
	text1 = "_It was once a center of the craft. Smiths came from all over. They camped outside. They came in and discussed techniques. Much was done here. Now I watch it alone._";
	text2 = "_One day, I hope, it will be returned to its glory, and artisans will come from all over to use its anvil._";

begintalknode 16;
	state = 13;
	nextstate = -1;
	condition = 1;
	question = "What sort of things were made here?";
	text1 = "_Essence blades and armor. Powerful enchanted equipment. Even puresteel was worked here. All gone, now. What a waste._";

begintalknode 17;
	state = 13;
	nextstate = 14;
	condition = 1;
	question = "Tell me about this anvil.";
	text1 = "_There is an enchanted anvil here, suitable for working even the most volatile of magical materials. I keep it locked away now, so that it can stay safe until more peaceful times return._";

begintalknode 18;
	state = 14;
	nextstate = 15;
	condition = gf(70,5) < 2;
	question = "Can I use it?";
	text1 = "_Hmmm. It should be used. It is a waste to let it lie fallow, and I would love for other artisans to spend time here again, trading secrets. But, despite its mass and its steel, the anvil is fragile._";
	text2 = "_For you to use it, you need to prove yourself. Show yourself strong enough to properly use what you might make._";

begintalknode 19;
	state = 15;
	nextstate = -1;
	condition = 1;
	question = "What do I need to do?";
	text1 = "_There are Unbound in the Dera Reaches. Near here, and to the north and east. Kill one of them. That would be enough to prove your competence, and to show that you are not completely against the people here._";
	code = 
		set_flag(70,5,1);
		toggle_quest(98,1);
	break;	
	
begintalknode 20;
	state = 10;
	nextstate = -1;
	condition = gf(70,5) == 1 && gf(66,4) > 0;
	question = "I have slain an Unbound.";
	text1 = "_Then, on behalf of the poor farmers and nomads of the Dera Reaches who have suffered because of those beasts, I thank you._";
	text2 = "_I will unlock the doors to the anvil. Please be careful not to damage it._";
	code = 
		set_flag(70,5,2);
		toggle_quest(98,3);
		award_party_xp(200,30);
		sf(70,11,1);
		sf(70,12,1);
	break;	

begintalknode 21;
	state = 10;
	nextstate = -1;
	condition = 1;
	question = "Can you show me your wares?";
	text1 = "_My wares?_ He snorts. _I am not a tinker. I only do custom work. Ever._";

begintalknode 22;
	state = 10;
	nextstate = -1;
	condition = gf(70,4) == 0 && has_spec_item(4) > 0;
	question = "I would like for you to make something for me.";
	text1 = "_You can craft life, but you are not a Shaper. I would not take the risk of aiding you unless you had a pass from Sage Taygen. Do you?_";
	text2 = "You show him the pass. He nods. _I do custom work of one specific, valuable sort. I am able to work puresteel. If you bring it to me, with payment, I can forge blades and armor from it for you._";
	code =
		sf(70,4,1);
	break;
	
begintalknode 23;
	state = 10;
	nextstate = -1;
	condition = gf(70,4) == 0 && has_spec_item(4) == 0;
	question = "I would like for you to make something for me.";
	text1 = "_You can craft life, but you are not a Shaper. I would not take the risk of aiding you unless you had a pass from Sage Taygen. Do you?_";
	text2 = "You don't. He shakes his head. _He is in Zephyr Oasis, to the north. You should see him soon, or you may find yourself having some difficulties._";

begintalknode 24;
	state = 10;
	nextstate = -1;
	condition = gf(70,4) > 0 && has_spec_item(8) == 0;
	question = "I would like for you to make something for me.";
	text1 = "_Do you have puresteel?_ You shake your head. _I can't help you._";

begintalknode 25;
	state = 10;
	nextstate = 16;
	condition = gf(70,4) > 0 && has_spec_item(8) > 0;
	question = "I would like for you to make something for me.";
	text1 = "You show your puresteel to the smith. He nods. _Puresteel blades and armor lack the flash of other enchanted items, but they have protective qualities that exceed all other such equipment._";
	text2 = "_With enough puresteel, and a payment of five hundred coins, I can work this material for you._";

begintalknode 26;
	state = 16;
	nextstate = -1;
	condition = has_spec_item(8) > 0;
	question = "Make gloves for me. (Give 500 coins and 1 piece of puresteel.)";
	text1 = "He shakes his head. _You don't have enough money._";
	text2 = "He takes the puresteel and the money. _Please wait._ He leaves the room and enters the inner forge. He is absent for some time. You hear much clanging and swearing. The magic involved in the process makes your hair stand on end.";
	text3 = "And then, after several hours of hard work, he returns with a pair of puresteel gauntlets. _It has been too long since I worked puresteel. Difficult work, but rewarding. I thank you._";
	code =
		if (coins_amount() < 500) {
			rs(2); rs(3);
			}
			else {
				rs(1);
				set_spec_item(8,-1);
				change_coins(-500);
				reward_give(468);
				}
	break;
	
begintalknode 27;
	state = 16;
	nextstate = -1;
	condition = has_spec_item(8) > 0;
	question = "Make a girdle for me. (Give 500 coins and 1 piece of puresteel.)";
	text1 = "He shakes his head. _You don't have enough money._";
	text2 = "He takes the puresteel and the money. _Please wait._ He leaves the room and enters the inner forge. He is absent for some time. You hear much clanging and swearing. The magic involved in the process makes your hair stand on end.";
	text3 = "And then, after several hours of hard work, he returns with a broad belt, puresteel plates set in thick leather. _It has been too long since I worked puresteel. Difficult work, but rewarding. I thank you._";
	code =
		if (coins_amount() < 500) {
			rs(2); rs(3);
			}
			else {
				rs(1);
				set_spec_item(8,-1);
				change_coins(-500);
				reward_give(167);
				}
	break;

begintalknode 28;
	state = 16;
	nextstate = -1;
	condition = has_spec_item(8) > 0;
	question = "Make a shield for me. (Give 500 coins and 1 piece of puresteel.)";
	text1 = "He shakes his head. _You don't have enough money._";
	text2 = "He takes the puresteel and the money. _Please wait._ He leaves the room and enters the inner forge. He is absent for some time. You hear much clanging and swearing. The magic involved in the process makes your hair stand on end.";
	text3 = "And then, after several hours of hard work, he returns with a gleaming shield. _It has been too long since I worked puresteel. Difficult work, but rewarding. I thank you._";
	code =
		if (coins_amount() < 500) {
			rs(2); rs(3);
			}
			else {
				rs(1);
				set_spec_item(8,-1);
				change_coins(-500);
				reward_give(131);
				}
	break;
begintalknode 29;
	state = 16;
	nextstate = -1;
	condition = has_spec_item(8) > 0;
	question = "Make leggings for me. (Give 500 coins and 1 piece of puresteel.)";
	text1 = "He shakes his head. _You don't have enough money._";
	text2 = "He takes the puresteel and the money. _Please wait._ He leaves the room and enters the inner forge. He is absent for some time. You hear much clanging and swearing. The magic involved in the process makes your hair stand on end.";
	text3 = "And then, after several hours of hard work, he returns with a pair of gleaming puresteel greaves. _It has been too long since I worked puresteel. Difficult work, but rewarding. I thank you._";
	code =
		if (coins_amount() < 500) {
			rs(2); rs(3);
			}
			else {
				rs(1);
				set_spec_item(8,-1);
				change_coins(-500);
				reward_give(349);
				}
	break;
	
begintalknode 30;
	state = 16;
	nextstate = -1;
	condition = has_spec_item(8) > 1;
	question = "Make a blade for me. (Give 500 coins and 2 pieces of puresteel.)";
	text1 = "He shakes his head. _You don't have enough money._";
	text2 = "He takes the puresteel and the money. _Please wait._ He leaves the room and enters the inner forge. He is absent for some time. You hear much clanging and swearing. The magic involved in the process makes your hair stand on end.";
	text3 = "And then, after several hours of hard work, he returns with a beautiful puresteel broadsword. _It has been too long since I worked puresteel. Hold tightly to that. It may be the only such weapon for many leagues._";
	code =
		if (coins_amount() < 500) {
			rs(2); rs(3);
			}
			else {
				rs(1);
				set_spec_item(8,-2);
				change_coins(-500);
				reward_give(68);
				}
	break;
	
begintalknode 31;
	state = 16;
	nextstate = -1;
	condition = has_spec_item(8) > 1;
	question = "Make a breastplate for me. (Give 500 coins and 2 pieces of puresteel.)";
	text1 = "He shakes his head. _You don't have enough money._";
	text2 = "He takes the puresteel and the money. _Please wait._ He leaves the room and enters the inner forge. He is absent for some time. You hear much clanging and swearing. The magic involved in the process makes your hair stand on end.";
	text3 = "And then, after several hours of hard work, he returns with a gloriously shiny puresteel breastplate. _It has been too long since I worked puresteel. Hold tightly to that. It may be the only such breastplate for many leagues._";
	code =
		if (coins_amount() < 500) {
			rs(2); rs(3);
			}
			else {
				rs(1);
				set_spec_item(8,-2);
				change_coins(-500);
				reward_give(42);
				}
	break;

begintalknode 32;
	state = 16;
	nextstate = 10;
	condition = 1;
	question = "I don't need anything made right now.";
	text1 = "He looks disappointed. _All right._";
	
//

	
//

begintalknode 50;
	state = -1;
	nextstate = 50;
	condition = 1;
	question = "Ellek'Sss";
	text1 = "This building is recent construction, something you see little of in the Dera Reaches. Something about the walls and floor is a little too perfect, as if it was built with the aid of magic.";
	text2 = "And the sole resident is entirely out of place. There is a drakon here. Neither young nor old. She is tall and muscular, and clearly very powerful. And she is displeased to have been disturbed.";
	text3 = "_Hssss. I am Ellek'Sss, traveler. I will let you speak before you are destroyed, but that isss all the mercy you should expect. Speak wrong or intrude upon my private quartersss and you will be destroyed._";
	text5 = "Ellek'Sss looks down at you with mistrust. She clearly wishes that she had been able to maintain her solitude.";
	action = INTRO;
	code =
		sf(70,1,1);
	break;
	
begintalknode 51;
	state = 50;
	nextstate = -1;
	condition = gf(70,6) == 0;
	question = "Die, rogue! (Attack.)";
	text1 = "_Ahssss ... I thought so. Thisss isss good. I can kill you, and none will know that I am found._";
	action = END_TALK;
	code =
		set_attitude(54,10);
	break;
	
begintalknode 52;
	state = 50;
	nextstate = -1;
	condition = gf(70,6) == 0 && gf(100,0) - (get_stat(20) / 3) >= 98;
	question = "I mean you no harm. I only wish to talk.";
	text1 = "_Sssss ... No. You ... I have heard of you. I wasss told of you before I left Gazaki-Uss. Your wordsss mark you. You are not loyal to the rebelsss._";
	text2 = "_I could let you live, but it isss too much of a risk._";
	action = END_TALK;
	code =
		set_attitude(54,10);
	break;
	
begintalknode 53;
	state = 50;
	nextstate = -1;
	condition = gf(70,6) == 0 && gf(100,0) - (get_stat(20) / 3) < 98;
	question = "I mean you no harm. I only wish to talk.";
	text1 = "_Sssss ... Yesss. You ... I have heard of you. I wasss told of you before I left Gazaki-Uss. Your wordsss mark you. You seem to be no foe of the rebelsss._";
	text2 = "_I will speak with you. Briefly. Before I return to my work. Stay out of my private grove, or I will make you pay._";
	action = SET_SDF 70 6 1;
	
begintalknode 54;
	state = 50;
	nextstate = 51;
	condition = gf(70,6) > 0;
	question = "Why are you here?";
	text1 = "_I am here because Sage Taygen isss weak. He hasss lost control of these landsss. I fill the void with foesss for him._";
	
begintalknode 55;
	state = 50;
	nextstate = 52;
	condition = gf(70,6) > 0;
	question = "Aren't you afraid of being found by the Shapers?";
	text2 = "_I fear nothing. But I must take care not to be found, or I would not be able to finish my mission._";
	
begintalknode 56;
	state = 50;
	nextstate = 53;
	condition = gf(70,6) > 0 && gf(100,5) == 2 && gf(101,5) > 0;
	question = "I am a servant of Ghaldring.";
	text1 = "_You are? Thisss isss good. You can infiltrate his town. Maybe you can even kill him. For how he treatsss creations, he deservesss it many timesss over._";
	
begintalknode 57;
	state = 51;
	nextstate = -1;
	condition = 1;
	question = "What sort of creations do you make?";
	text1 = "_I create vlish. It isss a special talent of mine, and they disrupt the mindsss of hisss servantsss. Very bad for their morale._";
	
begintalknode 58;
	state = 51;
	nextstate = -1;
	condition = 1;
	question = "Did you make the Unbound?";
	text1 = "_Those mad creaturesss were here when I arrived. I must avoid them. They would attack me asss surely asss you. Fortunately, they do not kill my vlish. Perhapsss they taste bad._";

begintalknode 59;
	state = 52;
	nextstate = -1;
	condition = 1;
	question = "Why?";
	text1 = "_Sage Taygen has a large laboratory to the east. If I was found, he would spare no effort to drive me away from it._";

begintalknode 60;
	state = 53;
	nextstate = -1;
	condition = get_stat(20) > 3;
	question = "Have you learned anything about his weaknesses?";
	text1 = "_He is unstable. Easy to frighten. Easy, I think, to drive from his miserable little settlement. When roguesss get too close to his oasisss, he flees to the fort to the east._";
	text2 = "_I have met with spiesss. If you enter his city from the south, you can slip into hisss palace. Then maybe you can find a way to stoke his paranoia._";

begintalknode 61;
	state = 50;
	nextstate = 55;
	condition = gf(70,6) > 0 && gf(70,7) == 0;
	question = "Can you teach me magic? Or Shaping?";
	text1 = "_I would not spend the time. Not unlessss you were an ally._";

begintalknode 62;
	state = 55;
	nextstate = 50;
	condition = gf(100,2) == 2;
	question = "I am working for Astoria.";
	text1 = "_Ahssss ... The ally of the northern rebelsss. But not of Ghaldring. But I am not fond of Ghaldring. So I might aid you, to spite him._";
	text2 = "_All right. I would spend a little time aiding you. But you must add generously to my hoard._";
	action = SET_SDF 70 7 1;

begintalknode 63;
	state = 55;
	nextstate = 50;
	condition = gf(100,5) == 2;
	question = "I am working for Ghaldring.";
	text1 = "_Yessss ... A true ally of the northern rebelsss. But I am not fond of Ghaldring. But the thingsss he would have you do benefit me asss well._";
	text2 = "_All right. I would spend a little time aiding you. But you must add generously to my hoard._";
	action = SET_SDF 70 7 1;

begintalknode 64;
	state = 55;
	nextstate = 50;
	condition = get_stat(20) >= 8;
	question = "I would help your kind, but only if you help me.";
	text1 = "Your words are incredibly persuasive. _All right. I would spend a little time aiding you. But you must add generously to my hoard._";
	action = SET_SDF 70 7 1;
	
begintalknode 65;
	state = 55;
	nextstate = 50;
	condition = get_stat(20) < 8;
	question = "I want to help your kind. Please help me.";
	text1 = "_Sssss. Pretty wordsss. But they mean nothing to me._";

begintalknode 66;
	state = 50;
	nextstate = -1;
	condition = gf(70,7) > 0;
	question = "I want to learn about magic.";
	text1 = "You conclude your training.";	
	code = 
		begin_shop_mode("Ellek'Sss",
		  "You managed to convince Ellek'Sss to teach you what she knows about magic. She knows a lot.",
		  60,5,0);	
	break;

begintalknode 67;
	state = 50;
	nextstate = -1;
	condition = gf(70,7) > 0;
	question = "I want to learn about Shaping.";
	text1 = "You conclude your training.";	
	code = 
		begin_shop_mode("Ellek'Sss",
		  "You managed to convince Ellek'Sss to teach you what she knows about Shaping. She knows a lot.",
		  61,6,0);	
	break;

//

begintalknode 70;
	state = -1;
	nextstate = 70;
	condition = 1;
	question = "Name";
	text1 = "This golem is starting to move very slowly. The air around it is growing hot.";
	text2 = "Now that it is moving, you can see a long, narrow crack running along its chest. Too thin to fit a blade, but barely large enough for the tentacles of a living tool. If you stuck one in there, you might be able to do some damage.";
	text3 = "Now that it is moving, you can see a long, narrow crack running along its chest. Too thin to fit a blade, but barely large enough for the tentacles of a living tool. Alas, your skills are inadequate to direct the tool properly.";
	code =
		if (gf(70,gf(70,19)) > 0) {
			rs(2); rs(3);
			}
		if (get_stat(21) < 8)
			rs(2);
			else rs(3);
	break;		
	
begintalknode 71;
	state = 70;
	nextstate = -1;
	condition = get_stat(21) >= 8 && has_item(255);
	question = "Use a living tool to disable the golem.";
	text1 = "You leap forward and direct the tool toward the crack. The small, delicate tentacles barely manage to slip in.";
	text2 = "You only manage to do a little damage before the golem pushes you away. The air around it is no longer hot. You seem to have disabled that part of it.";
	text3 = "With a firm twist, the golem stops moving. The air cools down. The creature has been disabled.";
	action = END_TALK;
	code =
		take_item(255);
		if (get_stat(21) < 11) {
			rs(3);
			sf(70,gf(70,19),1);
			}
			else {
				rs(2);
				sf(70,gf(70,19),2);
				award_party_xp(100,30);
				}
	break;
	
begintalknode 72;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "Smash the creature.";
	text1 = "The golem moves feebly to defend itself against you. Soon it will be able to move more quickly.";
	action = END_TALK;
	code =
		set_attitude(58 + gf(70,19) - 15,10);
	break;
	
begintalknode 73;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "Leave the golem alone.";
	text1 = "You back away from it. The air grows warmer. The creature will soon be active.";
	action = END_TALK;

begintalknode 76;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "You examine the golem. It is completely still, but it's also warm to the touch.";

begintalknode 77;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "When you get close to this trapdoor, the floor begins to vibrate under your feet. A deep rumbling sound comes from all around you. You turn and see the previously innocuous piles of stone you passed on the way in are moving.";
	text2 = "In moments, they have formed several crude stone figures. Very crude. They are covered with scratches and deep cracks. Ooze from the highly enchanted creations within the individual stones slowly oozes out.";
	text3 = "You start to sweat. Not from nervousness. The room is growing very hot.";
	text4 = "The golems don't move yet. They are still slowly reforming. The rocks are forming gooey bonds which hold them together. They aren't attacking yet, but they will be soon.";

begintalknode 78;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "At last, the power of the golems is broken. The creatures begin to crumble. Soon, they will be nothing but a scattering of gooey gravel.";
	text2 = "Your path to the trapdoor is clear.";

begintalknode 79;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "You pull mightily on the trapdoor, but it refuses to budge. You realize that the wood is glowing slightly. An enchantment is holding it shut.";
	
//

begintalknode 90;
	state = -1;
	nextstate = 90;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode 91;
	state = 90;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
		